﻿using System.Collections.Generic;

namespace EventBus.RabbitMQ
{
    internal sealed class RabbitMqConsumerClientFactory : IConsumerClientFactory
    {
        private readonly IConnectionChannelPool _connectionChannelPool;

        public RabbitMqConsumerClientFactory(IConnectionChannelPool channelPool)
        {
            _connectionChannelPool = channelPool;
        }

        public IConsumerClient Create(string queue, List<RouteInfo> routeInfos)
        {
            var client = new RabbitMqConsumerClient(queue, _connectionChannelPool);
            client.Connect(routeInfos);
            return client;
        }
    }
}